package com.itheima.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.mapper.OperateLogMapper;
import com.itheima.pojo.OperateLog;
import com.itheima.pojo.OperateLogQueryParam;
import com.itheima.pojo.PageResult;
import com.itheima.service.OperateLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OperateLogServiceImpl implements OperateLogService {

    @Autowired
    private OperateLogMapper operateLogMapper;
    @Override
    public PageResult<OperateLog> page(OperateLogQueryParam operateLogQueryParam){



        PageHelper.startPage(operateLogQueryParam.getPage(),operateLogQueryParam.getPageSize());

        List<OperateLog> logList = operateLogMapper.list();



        Page<OperateLog> p = (Page<OperateLog>) logList;//获取总条数和数据

        return new PageResult<OperateLog>(p.getTotal(),p.getResult());//返回总条数和数据
    }
}
